<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
    <ul class="layui-nav">
    </ul>
</div>
<div class="layui-card">
    <div class="layui-card-body" style="margin-left: 10px !important;">
        <form class="layui-form layui-form-pane" id="commentForm">
            <div class="main-container" style="margin-left: 0 !important;padding-top: 20px !important;">
                <div class="block-first">
                    <div class="layui-form-item">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md6">
                                <label class="layui-form-label" style="height: 38px;">单点登录</label>
                                <div class="layui-input-block" style="border:1px solid #ccc">
                                    <input type="checkbox" id="issingle" disabled lay-skin="switch" lay-filter="issingle" lay-text="开启|关闭" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-md6">
                                <label class="layui-form-label" style="height: 38px;">流程手动签名</label>
                                <div class="layui-input-block" style="border:1px solid #ccc">
                                    <select id="isqian" name="isqian" lay-filter="isqian" ></select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['laytp','button'], function() {
        var form = layui.form;

        facade.ajax({type:'get', url: ask_company_can}).done(function(res){
            if (res['code'] === 2000) {
                var data = res.data;

                if(data.issingle < 1){
                    $("#issingle").attr('checked','checked');
                }

                if(data.butauth.length > 0){
                    $("#issingle").attr('disabled',false);
                }




                var isqian_str = '';
                var isqianarr = res.data.isqianarr;
                for (var key in isqianarr){
                    if(data.isqian == key){
                        isqian_str += '<option value="'+key+'" selected>'+isqianarr[key]+'</option>';
                    }else{
                        isqian_str += '<option value="'+key+'">'+isqianarr[key]+'</option>';
                    }
                }
                $("#isqian").html(isqian_str);

            }
            render_from();
        });

        form.on('switch(issingle)', function(data){
            facade.ajax({url: ask_company_can, data:{issingle:data.elem.checked ? 0 : 1}}).done(function(res){
                if (res['code'] === 2000) {
                    window.location.reload();
                }
            });
        });

        form.on('select(isqian)', function(data){
            facade.ajax({url: ask_company_can, data:{isqian:data.value}}).done(function(res){
                if (res['code'] === 2000) {
                    window.location.reload();
                }
            });
        });
    });
</script>
</body>
</html>
